import implementaciones.RedBlackSearchTree;



public class RedBlackTreeSet implements WordSet{

    //RedBlackSearchTree donde se guardarÃ¡n las palabras.
    
    private RedBlackSearchTree<Word> theWordTree;
    
    /**
     * Constructor del RedBlackTreeSet
     */
    public RedBlackTreeSet(){
        theWordTree = new RedBlackSearchTree();
    }
    
    @Override
  
    public void add(Word wordObject) {
        if(!theWordTree.contains(wordObject)){
            theWordTree.add(wordObject);
        }
    }

    @Override
   
    public Word get(Word word) {
        //Se revisa si la palabra existe
        if(theWordTree.contains(word)){
            //De ser asÃ­, se devuelve la misma palabra.
            return theWordTree.get(word);
        }else{
            return null;
        }
    }
        
}
